package org.example;

import java.io.IOException;

public class Demo {
    public static void main(String[] args) {
        int cap = 32;
        final int MAXIMUM_CAPACITY = 1 << 30;
        System.out.println(Integer.numberOfLeadingZeros(cap));
        System.out.println(Integer.numberOfLeadingZeros(cap - 1));
        int n = -1 >>> Integer.numberOfLeadingZeros(cap - 1);
        int x = (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1;
        System.out.println(x);
    }
}
